﻿using System;
using System.ComponentModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SL.WorkfowDesigner.Annotations;

namespace SL.WorkfowDesigner.ViewModels
{
    public class MainLayoutViewModel : INotifyPropertyChanged
    {
        public MainLayoutViewModel()
        {
            ShowGridLines = true;
        }



        private bool showGridLines = true;
        private int horizontalGridCounts = 150;
        private int verticalGridCounts = 75;
        private int zoomLevelValue = 100;
        private bool enablePanZoom = false;

        public bool EnablePanZoom
        {
            get { return enablePanZoom; }
            set
            {
                enablePanZoom = value;
                OnPropertyChanged("EnablePanZoom");
            }
        }

        public int ZoomLevelValue
        {
            get { return zoomLevelValue; }
            set
            {
                zoomLevelValue = value;
                OnPropertyChanged("ZoomLevelValue");
                OnPropertyChanged("ZoomLevelValueScale");
            }
        }

        public double ZoomLevelValueScale
        {
            get { return ZoomLevelValue/100d; }
        }

        public bool ShowGridLines
        {
            get
            {
                return showGridLines;
            }
            set
            {
                showGridLines = value;
                OnPropertyChanged("ShowGridLines");
            }
        }

        public int HorizontalGridCounts
        {
            get { return horizontalGridCounts; }
            set
            {
                horizontalGridCounts = value;
                OnPropertyChanged("HorizontalGridCounts");
            }
        }

        public int VerticalGridCounts
        {
            get { return verticalGridCounts; }
            set
            {
                verticalGridCounts = value;
                OnPropertyChanged("VerticalGridCounts");
            }
        }

        private double horizontalGridActualWidth;
        public double HorizontalGridActualWidth
        {
            get { return horizontalGridActualWidth; }
            set
            {
                horizontalGridActualWidth = value;
                OnPropertyChanged("HorizontalGridActualWidth");
            }
        }

        private double verticalGridActualHeight;
        public double VerticalGridActualHeight
        {
            get { return verticalGridActualHeight; }
            set
            {
                verticalGridActualHeight = value;
                OnPropertyChanged("VerticalGridActualHeight");
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
